//
//  MTWeiboManager.h
//  huipai_3
//
//  Created by tan xi on 11-9-8.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "OAuthEngine.h"
#import "QWeiboClient.h"
#import "OAuthController.h"
#import "Renren.h"
#import "QVerifyWebViewController.h"
#import "MinroadOauth.h"
#import "KxOAuthController.h"
#import "KxOAuthEngine.h"
#import "TencentOAuth.h"

enum {
    MTWMSinaWeibo       = 1,
    MTWMTencentWeibo    = 2,
    MTWMKaixin          = 3,
    MTWMRenren          = 4,
    MTWMDouban          = 5,
    MTWMQQ              = 6
};

typedef NSInteger MTWMWeiboType;

@protocol MTWeiboManagerDelegate;

@interface MTWeiboManager : NSObject 
<OAuthEngineDelegate, OAuthControllerDelegate,          //新浪委托
KxOAuthEngineDelegate, KxOAuthControllerDelegate,       //开心委托
QWeiboClientDelegate, QVerifyWebViewControllerDelegate, //腾讯微博委托
RRSessionDelegate, RRDialogDelegate, RequestDelegate,   //人人网委托
OauthToken,
TencentSessionDelegate>{    
    NSString    *userName;
    OAuthEngine *sinaEngine;
    KxOAuthEngine   *kxEngine;
    QWeiboClient    *QClient;
    Renren          *_renren;
    MinroadOauth    *_douban;
    TencentOAuth    *_QQOAuth;
    id<MTWeiboManagerDelegate>  delegate;
    
    NSString    *tempSina,
                *tempKaixin;
}

@property (nonatomic, retain) id<MTWeiboManagerDelegate>  delegate;
@property (nonatomic, retain) NSString  *userName;
@property (nonatomic, retain) NSString  *tempSina,
                                        *tempKaixin;

- (id)initWithUserName:(NSString*)userName;
- (BOOL)isLoginWithType:(MTWMWeiboType)type;
- (void)deleteWeiboWithType:(MTWMWeiboType)type;
- (void)saveWeiboWithType:(MTWMWeiboType)type;
- (void)getSavedWeiboToken:(MTWMWeiboType)type;
- (void)showAuthentication:(UIViewController*)controller 
                  withType:(MTWMWeiboType)type;
- (void)postType:(MTWMWeiboType)type Text:(NSString*)text imageData:(NSData*)data;

@end

@protocol MTWeiboManagerDelegate <NSObject>

@optional
- (void)userName:(MTWMWeiboType)type string:(NSString*)name;
- (void)postInfoSeccess:(MTWMWeiboType)type;
- (void)postInfoFaild:(MTWMWeiboType)type error:(NSError*)error;

@end
